package com.example.demomk.Utils;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.demomk.R;
import com.example.demomk.databinding.ActivityBottombarBinding;

public class bottombar{
    private Activity activity;
    private ActivityBottombarBinding binding;
    private View navBarView;



    public bottombar(Activity activty) {
        this.activity = activty;
        init();
    }
    private void  init(){

        ActivityBottombarBinding binding = ActivityBottombarBinding.inflate(activity.getLayoutInflater());
        navBarView = binding.getRoot();

        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();

        decorView.addView(navBarView, new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT
        ));

    }
    public void destroy() {
        if (navBarView != null && navBarView.getParent() != null) {
            ((ViewGroup) navBarView.getParent()).removeView(navBarView);
        }
    }
}